package com.baeldung.bidirect;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dzy on 2018/9/2
 */
public class User4 {
  public int id;
  public String name;

  // CustomListSerializer ,实现只把 items的Id 序列化
  @JsonSerialize(using = CustomListSerializer.class)
  public List<Item4> userItems = new ArrayList<>();


  public User4(int id, String name) {
    this.id = id;
    this.name = name;
  }

  public void addItem(Item4 item) {
    userItems.add(item);
  }
}
